Fix unsigned lengths to use 0 for invalid instead of -1