some fixes,  tests added