improvement in echo example (aware of WEVENT_WRITE)