Added function to fix bad characters