Issue #29. Add more robustness in case the content-type checking fails.