Added logic to spjs.ensureCsomLoaded() to wait until SP.SOD is defined.