UnitTest and bugfix