correction of some bugs