Handle key types correctly