Fix various issues related to issue #180.