adding nil checks to tests