Remove global declaration to avoid SyntaxWarning
Check if a dataset is on tape when we look for locations. Fixes #4428