Bug fix in QDA

Fixes #3721