fixing promise issue