improve python3 compatibility

add basic py3 compatibility
demonize part is not fixed yet