fix variable declaration in try/catch