Preventing exception in pause