Some more fixes + tests