better last-line handling