fixed issue with null termination of buffers; used strn