fixed the temp variable situation