[#5815290] Fix error if last expression is the result of a square root

For some reason roots don't have `.last()` on their expression. There might be a
better fix.

As prophesied, this is the continuation of #4 because of some good in situ QA.