Avoid sulfer rich foods in addition to the normal vermicomposting no-nos. The best way to prevent odor is to ensure adequate air circulation and proper hydration. Most odor comes as a consequence of too much moisture.
As for the fruit flies, you can try placing cups of vinegar in the bin, but this will probably only reduce the quantity of flies rather than eliminate them. Some kind of predator may work, but you're better off starting over.
- dump the bin
- pick out the worms
- wash them like you would a basket of root vegetables
- clean the bin thoroughly
- start composting again from scratch
You'll lose some worms to stress, but you'll ditch the flies, too.