add filter function
an attempt try to fix the encode error