Added error handling to networking scripts