Fixed #276, #293 -- refactored provider creds discovery