Fixes getProvider() implementation after adding more checks