Make net code more robust