Adjust class loading to work in more cases