change error func again + add plot