minor optimization and corner cases for persistent test