added test for UnicodeDecodeError and fixed error