Fix bugs found by unit tests. Work around udis86 bugs.