fix LIMIT in SQL