don't use cursors in threaded code, they're not thread-safe