Small fixes and tests added