Fixes warnings, wrong synchronize on local variable rather than using the global one and adds additional check when starting chat.