                                 ir.createStore else_val, cond_val if load_result
                                 ir.createBr merge_bb
 
-                @doInsideBlock merge_bb, =>
-                        if load_result
-                                @createLoad cond_val, "cond_val_load"
-                        else
-                                merge_bb
+                ir.setInsertPoint merge_bb
+                if load_result
+                        @createLoad cond_val, "cond_val_load"
+                else
+                        merge_bb
                 
         visitReturn: (n) ->
                 debug.log "visitReturn"

                if load_result
                        cond_val = @createAlloca @currentFunction, types.EjsValue, "%cond_val"
                
                # first we convert our conditional EJSValue to a boolean
                cond_truthy = @createCall @ejs_runtime.truthy, [@visit(n.test)], "cond_truthy"

                insertBlock = ir.getInsertBlock()
                insertFunc = insertBlock.parent


                merge_bb = new llvm.BasicBlock "cond_merge", insertFunc

                # we invert the test here - check if the condition is false/0
                left_visited = @generateCondBr n.left, left_bb, right_bb

                @doInsideBlock left_bb, =>
                        # inside the else branch, left was truthy
