This patch causes another link error, reverting until I can investigate. This reverts commit a96a6ed8.