fixed InFunctionTests
fixed a potential deadlock condition