Improve factory reset