change printf to sprintf