small corrections to hardware.c rechecked by hand