some fixes done, tests added