Made memory modified safer from optimizations.