Fixing permissions for writing