Fix unhandled exception if urlOptions isn't defined

This fixes unhandled errors when using custom query functions.