fixed variable declaration bug