Fixed undefined  because change to  before, fixed some comment