Add the error handling - taken from jetpack.
Check output a bit before outputting