Cleanup and unify dump-mechanism, fix a memory leak, add ubus support