Add some basic error handling