Null check
Fixed inaccurate determination of hit vector