Fix bytes/string handling in Python 3 static_proxy. Closes #866.