fixed casting, and made conf2bin return uint8 matrix