Resetting file to the correct state.