modified functions send and recv