now with some error handling