Properly handle limit 0

Fix is a little sloppy but fine. Typecasting makes it a pain to check arguments. @vschoettke can you look at whether the oracle stuff makes sense?

cc @leore

Closes #585