Trying to catch errors a bit more reliably