#524 tests fixed
#524 polished and test fixed