Fix recvmsg; also fix minor cast errors