improved stability by changing locate watching c code