fix import for python27, fix bug.