Bug fixes for removing hidden chars