error managment added