added eror handler