fixing bug in the case of pause