fixpermissions function added