Closes issue #4859. --HG-- branch : trunk
Patch by Paradox (some cleanups was needed) --HG-- branch : trunk