Fixed bugs and made stress tests