added validator & bug fix