added flush to send/receive