Fixed the bottleneck detection algorithm and added another test for it