Untested DTB support
Fix resource leak and fixed formatting