Change try/except to if statement that checks for more specific problem