make sure that both $permissions and $oldPermissions have the same type