Bugfix: gridseed: use a signed int so returning -1 has defined behavior