fixed a logic bug in the tevent nesting code