Fixed heap errors.