check for empty object before proceeding