fixing sanitization function for return value