Add graceful handling of primitive types for key lookups