fix a number of bugs related to mach message send and receive