added chat and some bug fix