fixed $target undefined