more linking and cleanup

refer to bug 21898