Bugfix in route function, remove last slash with optional parameter non provided