fixed error where object was being returned where it was expecting an array

Fixed an error in the code where an object was being returned where it was looking for an array.