some tests added and fixed bug