Fixed bad casts of NSUinteger to int. This no longer handles NSNotFound.