Misc fixes from bytecoin