Updated the way to check whether an object is an empty object.