Fix bug with extra trailing \n