fix resume logic