add basic error handling