Improve error managment