Fixed terrain elevation not rendering properly
Also fixed memory allocation issues