fix terms recursion and correct 404 message