Handle NaN results from Presto server
Minor refactor