FIX memory leak because dettached element on inline function