Fixed error in index.get_max and added test cases.