Improve check if running in OSGi