Fix error on renaming a tab with filename defined

Also function GetMax was defined twice (once instead of GetMin). GetMin
isn't used anywhere though.