fixed crush and other bugs