fix some stupid mistakes, unit test passes