prevent accessing property of null/undefined objects