fixing promises issue