Improved regex for trailling slashes to hopefully fix all problems.