Fixed some more prog5 issues, specifically memory allocation