unit tests and small fix for prev commit