Bug fixes for PR #44