Bugfix: unsigned int cannot hold value of npos, which can be negative.