add iswht for netbsd
better testing for invalid flags