some refactoring and fix
fixed test build error