fixing api exception