fix undeclared symbols and reference to "state" instead of "this.@state"