minore code refactoring to the permission migration