Edited Temp_lookup

Added extra checks and changed an incorrect lcall