fix bugs in range fetch