Repaired TEMP routines