Proposed patch for Issue 776