promisify some codes