fix some bugs here and there