Fixed MAJOR bugs