support debug option

closes #344