refactoring

test and fix bug