corrected for recent mesa versions
Merge pull request #19 from tronje/master

Correct code for recent mesa versions