Fix paging with queries starting with comments

Closes #144
Includes testcase