fix up ensure logic causing circular dependency