Fixed subtle bug with UnreadMessage and added test