fixed bugs

figure out count hex number converting function.