Fixed chat and api. Updated API doc.