fix wrapping of count queries with trailing comments