ensure file modes are correct