improve whitespace handling