tests added, some fixes