More unit tests + minor fix uncovered by them (boundary whitespaces should be ignored).