fix many bugs T^T