Fix Ajax error when creating a new site.

WIP
#1017