modified to run with python3.3