When creating a material line, the purchase price of the preferred supplier was taken over instead of the entered supplier

Retrieving the correct price before saving a material line with a purchase price agreement did not work correctly, resulting in the wrong purchase price being used when ordering a purchase order.