changed from send() to write()