corrected some bugs