fix search with limits for sql based modes