Added changes from Elgg 1.8.18.