Fixed memory creation programs and changed template