safe failures in runAlgorithm with better error messages