remove temp variable and correct a mistake