Fixed some bugs with binary conversions and faults need to check with extensive test