checking for nils instead of empty array