fix the bug of losing data when go backward from contracts