fix some ordering issues