refactoring and fix bug for CI