Fix tailing slash with query. Closes #1763