full fixes + unit tests