Working chat and some bugfixes