Fixing possibly starvation issue in API