Fix problem with ordering keys