fixed wrong var sign cast.
loc is unsigned int, not int.