Fix typos and add Python 3 support