Python 3 fixes for running directly