improve archive fuction