Fixed a bug that chose inccorect u_i in KeyDerive