Fix bug in to_bytes_packed when packed size > unpacked size.