Fix some python 3 related issues