Fix  and tests