fixed null termination of buffer