Correction of some bugs