common: port the tests as well and fix one bug