fixed toBinary