fixes concurrency issues in send/receive

from frontend socket