fixing api.js