use temp variable so we don't reference freed memory