fixed inital workaround code for python3 support. Unclean, but works in python3 now.