When Hasan (may Allah have mercy on him) was asked about this, he replied that a person's intention will be taken into account.