fix #1022: Variable redeclaration is not detected