bug fix

. tail was reversed
. filename was missing