Fix query alter to return correct values.

#1