port to ES5, fix unread count going into minus