fixed empty line and line end handling