I do not know a way to make this work without the IAL being filled.
But your unset isn't executed because return simply halts the current script. /help /return
You only have to replace the unset- and return-line in the else-block.