solving bug when sanitise return error if value is undefined or null