fix bugs for so tests pass