Fixing signed/unsigned comparison problem

Thanks to Martin Maurer for spotting this!

Fixes #141