updated fixPermissions for more cases