I'm investigating the issue with the "Apply the payment to the same membership" not working when committing the batch.
You should be able to use the API to apply the payment to the correct Recurring Gift and to search for the membership ID or Import ID and then apply the payment to that membership.
Here is our API documentation that will help you get started. You can also ask any questions you may have on our API forum. We can also write this for you as a service if you're interested.