Fixed a allocation error. Untested. (Unusable version)