set file modes correctly