Some bug fixes on fold manager