not crash if output folder don't exists, and add debug flag functionality