bug fix for variable declaration in for statement