fixed $itemsCount bug in ResourceHandler