Added test cases for GitHub issues #662 and #739.