Fixed some of the allocation problems