On flat and injective dimension