fixing with promises