Fixed a bug with tpf