Better error handling small fix