Make index creation work in all cases