fixed weird file overwrite