fix substitute problems