Merge pull request #949 from nico/staterr