Java.lang.NullPointerException: Cannot get property 'x' on null object - when running a groovy script