build using filtered idf
fixed type cast