fix negative message count bug