fixed bug in ToBinaryString