fix bug in calculate w, make it complete
may not calculate  Ab every time.