update gateway manager script: handle network errors, support detail logs