fixed try/except syntax