save files to original name and some bug fixes