modifying few code to avoid that encoding doesn't match system encoding