add test, fix issues