Fixed infinite event handler in trend analysis