Hamstring cramps

Anyone here suffer from hamstring cramps? I have been getting them on exercises where the leg is at 90 degrees, like bench press and even lat pulldowns. It's freaking weird. Something about that position just sets them off.

I take magnesium and stretch them a lot, but nothing seems to help. Any suggestions?