working serialization of discretized array