make sure buf is initialized before accessing

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Merge pull request #17 from andrewgregory/working

Make sure buf is initialized before accessing