Split check_target into target_dir and check_target