fix send/recv functions