Fixed a memory error and an issue where environment variables were put in without the special tags