fixed error with 2 dimensional arrays