Fixed to be compatible with SWIPL v7