improved string to int converting