Issue #2177637 by InternetDevels: Replace theme() with drupal_render() in ajax.inc.
Issue #2156649 by amateescu: follow-up to fix broken HEAD.