Edited creation of vector image by allocating a region, but runtime error remains