Fixing bug with offset in queries.