misc fixes, tests