Fix unit types and add regression test.

Closes #136.