Fixed bug regarding word counting