Fixed varable name conflict and clean up code for non ascii text