(backport from HEAD) backout logic fix, it wasn't a fix at all but instead broke the original behaviour
(backport from HEAD) backout logic fix, it wasn't a fix at all but instead broke the original behaviour

zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb