some bug fixes in cache chain matching