removed bugs during file save, adding more cases