finish alloc functions