Added count rptools script function and fixes for numeric comparions.