fix endbug