Fixed buf size issues and sped up atoi