fix tailopt for calls that don't return intermediate results and throw when a non tail-recursive call is detected