Fix treating read permissions as write permissions.