fixed bug undfined variable