Debug fixes

includes the debuginfos branch and some fixes/improvements.