better communication with client, wrong size of messages fixed