fixed the pause functionality