fixing readpermissions/writepermissions