fix db ordering