added bad gateway code