Code fixes for PR #7