Fix a couple of small bugs.

Closes #841 and partially addresses #840 .