fix a bug in filter_chain()