fixed bug with invalid variable