Various fixes.

fixes #430