Preheat oven to 350 degrees. Chop green beans and mushrooms into bite sized pieces. Cook green beans until just tender and saute onions and mushrooms together in a pan until onions are clear. Add garlic at the end and saute but do not burn garlic. Combine cooked beans and mushroom mixture in a bowl. Melt two tablespoons butter in a large skillet over medium heat. Stir in flour until smooth and cook for one minute. Stir in salt, sugar, black pepper, sour cream, 1 cup of cheese, and 1/2 the can of french fried onions. Add spoonfuls to the green bean mixture and toss until sufficiently covered. Transfer mixture to a casserole dish. In a small bowl toss together ritz crackers, the remaining french fried onions, and the remaining butter. Sprinkle over casserole. Bake for 20 minutes. Add remaining cheddar cheese to top and continue baking for 10 minutes until top is golden brown and cheese is melted.