backport compilation fix

signed unsigned comparison failing in gcc491.