fixed chat retrieving logic