Corrected nul termination handling