use strpos instead of strlen to better detect whether we are dealing with a fatal error