Backported fix from EK goupx

Fix for issue #9