Check for the existence of the key. Fixes #611.

@UtahDave, see if this fixes #611 please.