use 'in' instead of has_key.