Fix query fees

resolve #839