fix indexed ports not being filled correctly in some cases