Fixed typo/bug in lambda lifter.

Also added a testcase. And some debug code that
will have to be taken out later.