Fix issue where output could be truncated