handle arrays correctly