modified for supprt python3