add debug option and debug mode