Straightened out the logic to catch null results

This should fix issue #2