Fixed passing of arrays to functions