Removed ipdb temporarily
More fixes. Replaces basestring, fixed imports. Fixed some old calls that don't exist in python 3