Fix handling of NULL character