Fixed issue where $target is not set