works with class unloading