fixed invalid array access for empty objects