Fix num_to_bytes wrong answer