modified: brm func to ensure no / at the end of path