Fix if-expr and add some tests