Crossing over occurs when