Fix bug in LIMIT clause