add some not so clean classloader logic to make it work in osgi