refactor: use Hash::has_key instead of getting null