fix bug and add sanitize