bug fix, thanks to unit tests
More tests