added extra null check to finalizeResults()