Replaced str2num by sprintf