changed param $debug into $settings