Fixed refactoring-introduced segfault when TEA=on