More robust check for running_under_sd