Fixed last fix
Fixed NPE in gateway shutdown