Fixed the intersection function.