a number of bugs fixed, but some still exist in receiving messages