sys.maxint doesn't exist in python3: fix magic.py