Fix Ajax error when creating a new site.

#1017 
@RoySegall , please re-add the VSite test already wrote to this branch.