Bug fixes.

fixes #17
fixes #18