minor defensive code additions