removed unused bufsz variable