fix promise bug