Fix for leaking result set and sum of unsigned int/long