Fixed key comparison bug