fixed problems with multibyte unicode characters
fixed null string error
removed debug printouts, cleaned up code
removed debug printout
removed debug printout