try has_key rather than ?defined