typo with undefiend error variable fixed