fix tarring function