Fix 502 "bad gateway" bug