Add preparation for provider (bug 942361)

because I don't think you want to run the code below on error