merged mining working and bug fixes