handle more edge cases for the whitespace checks