Fix load messages function