some fixes
added some tests