fixing promise order