Fix changing the mode of a file