fix bug in certain reading queries