Fixed promise logic