fix a bug in fetch query