fix a bug when non string values throw exception in sanitize