check for type array before array key exists