improved timeout trap behavior