Fixing a bug in checking api availability