made the file loading process more robust, copies to a tmp dir before moving into the final location.