2002 BMW 325I stalls out after RPM's racing

The alternator for my 2002 BMW 325I was replaced last Fall. Since then my car stalls out (mostly at a stop light or sign} and the RPM’s are racing up and down. I also happens when I turn a corner. The last thing that was done to it was a new mass air flow meter. This did not solve the problem. Any ideas?