bug-fixes in Receiving socket message logic