simplifying trailing slash check