Fix toByteArray implementation.