Fix dictionary key handling for primitives that get boxed