replace try/except with simple if/then to avoid capturing non-related errors