changes from ckolivas/cgminer