small modifications to file writing