Pull request #1721 bug fixes