fixing empty object checking