checking length
added protection from test hangs
WriteLine should not be used