better performance fix for #269
Merge pull request #271 from dirkweissenborn/master

Better performance for #269.