Fixed error with not properly removing last url segment