add logic for filepaths that end with a slash