Fixed incorrect variable being assigned