cleanup db_target_setup usage and bug fix the setting of fd