Fixed a bug with pause/resume