fixed message counter to be windowState aware.