Bug fixes

Fixes requested.