Fix nil error and change total printing