improved hinting and exception catching on runQuery