Selftest fix; some debug helpers