made compatible with python3
Update fix from #145