For the "limit ?" case, getLimit may return -1 -- test against this and don't use the -1 value.