Fixed variable error

and another bug