added check for latest_message