Changed sprintf to vsprintf.