correction for some bugs