improve python3 compat