fix array handling