Expand debug flags and fixup compilation warnings