fix buffer overflows and format issues
Merge pull request #20 from JFreegman/master

fix buffer overflows and format issues