Python syntax fixes