refine save load codes