trim excess newlines