fixed a bug in generating gateway configuration