change check behavior of the directive, fixed filtering bug