Anomalies, Fayet-Iliopoulos terms and the consistency of orbifold field theories