correctly serialize ranges