Fix variable declaration bug