Fix broken eventlisten and small refactor and catch rendering issues

 Catch rendering issues.

Catch and warn on rendering issues in top files. Closes #8799.

Backport fix for #12989