fixed directory without trailing slash bug