fix from 3.1.1 merged into master