Ordering issues with dict keys