fix some bugs and re-layout chat