Escape bad values when using the toolkit