Refactor custom class loading flag into InternalFlags