Added fix to handle trailing slash paths