fix flip card functionality