rewrite lost/restore handler