added a null check
test with Groovy 2.3.5