Fixes an reference error when api is not available