fixed incorrect segment offset count when the URI has a trailing slash. closes #1327