add better diagnostic output