Try to filter out bad maps

fixes ticket:3982
Merge branch 'bugfixes' into 3.1