fixed the bugs and passed stress test