fixes promise bug