added checkNull
added function assert to combine multiple checks