Fixed bugs in the lifting where patterns where lifted as expressions and in the wrong order.