Fix double remove in PermissionManager, fix sqlite