ensure that ns is not undefined at the start