better error checking for provider controller