Fix error message allocation

* Increase 1024 to 1026 to include room for space and comma
* sizeof(1) can return 4 for 32-bit systems and 8 for 64-bit systems
Remove unused variables