fixed csv null bug; improved logging