Issue 1824

Patch for #1824.