Added safeguard against overwritten files