Retardation effects and gauge transformations in the Bethe-Salpeter equation