fix a bug related with dictionary order.