fix #182. Don't segfault on queries with invalid limit clause.