Added more error handling for...errors