Fixed sorting/limit problems