Pass resolve and reject properly, avoid global xhr