Updated fix for issues #741 and #770