added checks for empty objects and empty array types