fix #776 and improve #747 - remove whitespaces selected upon sanitization