added better backup features, fixed bug