fix some wrong logic in costmodel and search algorithm