Fix issues caused by dict key order.