Check length of bookmark name before calling substring on it.
Kill trailing slash.