High resolution imaging of massive young stellar objects and a sample of molecular outflow sources