add tests, fix some for manual CPI