Fixed regressions introduced in last commit (unit tests)