improve whitespace detection. resolves #452.