Preserve dtype in merge keys when possible