Fix a possible uncaught attribute error. Thanks for the bug report, bela.hausmann.