added check for invalid object when retrieving object property