Fix many bugs before