Fix #519 problem of deferred loading after $.ready. Also fix error in content load.