fix logic nil test