fix bugs in fetch