Misc fixes. Closes #154.