fixes small bug in the swap_a_for_an method