fixed bug in sortBy where incorrectly formatted object was being returned