fix bugs in fetch when messagesize is out of range