fix some major bugs