Fixed critical bugs in v2_2; have to make the same in v3