Do not require output but check for error first

Add debug flag to not delete temporary directories.