Don't accept non-existant exercises. Fixes #1520 and #1546.