Minor cleanup and make sure the tmp variable is clean