String dualities in the presence of anomalous U(1) symmetries