Merge pull request #706 from dorkster/bugfixes

Replace atoi() with toInt()