fix: variables were not accessible in catch block