Bug fixes.

Resolves #272 #233