Fix major bugs