corrected tempRes variable reset: object and not variable