refactor checkpoint interface and fix bugs