Python 3 compatability fixes

Signed-off-by: Zaar Hai <haizaar@haizaar.com>