Better empty array detection