fix watchDirectory's callback handling