Fixed bug in nullcheck