Fix return value of API functions