tested and working with SWIPL 7.1.28 kernel