improve isspace based on stevengj's feedback