small fixes; added tests
finallly final