Fixed pausing and resuming bug