bug fixing in pause/resume logic