fix variable declaration bug