backport of 02d3475d2f038a5fcf8dbbd2b8e1aff289106dbc from trunk, closes #599
merge e7e30c7b3acae4c2a2083267a5965e37bfe52053, refs #599