removed write-only $gateway variable