fix Error catching