Fixed ensure bug