more precise check for spaces