Fixed memory error when running in curved mode...