add debug flag and test for #69