changed str to msg to prevent clobbering. changed repr call to unicode, which seems...