optimized some substitution