Integrate Philip patch for bug #281
closes #281