improve special character handling