remove trailing whitespaces
error handling for follow mode

see issue #141