Detect safe_mode and output correct error, closes #2006