correct target directive handling error handling