tf: fixed few bugs, added [] implementation