Remove use of has_key

Add test to ensure coverage.