Problem with printEnd solved

This version works with scalar variables