solve bug when pausing