Add more error catching