Fixed heap corruption in test