Added more checks before ob_start()