fixed loading messages and save to db