Fix some minor bugs

1. GetMax was defined twice.
2. Tab renaming crashed in some cases because of a typo in function
name.
3. Incorrect exception type in RemoveBookmark
Merge pull request #17 from tp7ptr/bugfixes

Fix some minor bugs