                 insertFunc = insertBlock.parent
 
                 then_bb  = new llvm.BasicBlock "then", insertFunc
-                else_bb  = new llvm.BasicBlock "else", insertFunc
+                else_bb  = new llvm.BasicBlock "else", insertFunc if n.alternate?
                 merge_bb = new llvm.BasicBlock "merge", insertFunc
 
                 # we invert the test here - check if the condition is false/0
                 cmp = ir.createICmpEq cond_truthy, consts.false(), "cmpresult"
-                ir.createCondBr cmp, else_bb, then_bb
-
-                ir.setInsertPoint then_bb
-                then_val = @visit n.consequent
-                if load_result
-                        ir.createStore then_val, cond_val
-                ir.createBr merge_bb
-
-                ir.setInsertPoint else_bb
-                else_val = @visit n.alternate
-                if load_result
-                        ir.createStore else_val, cond_val
-                ir.createBr merge_bb
-
-                ir.setInsertPoint merge_bb
-                if load_result
-                        @createLoad cond_val, "cond_val_load"
-                else
-                        merge_bb
+                ir.createCondBr cmp, (if else_bb? then else_bb else merge_bb), then_bb
+
+                @doInsideBlock then_bb, =>
+                        then_val = @visit n.consequent
+                        ir.createStore then_val, cond_val if load_result
+                        ir.createBr merge_bb
+
+                if n.alternate?
+                        @doInsideBlock else_bb, =>
+                                else_val = @visit n.alternate
+                                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
                 
         visitReturn: (n) ->
                 debug.log "visitReturn"

                entry_bb = new llvm.BasicBlock "entry", @literalInitializationFunction
                return_bb = new llvm.BasicBlock "return", @literalInitializationFunction

                ir.setInsertPoint entry_bb
                ir.createBr return_bb
                        
                ir.setInsertPoint return_bb
                ir.createRetVoid()

                @literalInitializationBB = entry_bb

        # lots of helper methods

        createLoad: (value, name) ->
                rv = ir.createLoad value, name
                rv

                        # if there were bound args we have to fall back to the runtime invoke method (since we can't
                        # guarantee enough room in our scratch area -- should we inline a check here or pass the length
                        # of the scratch area to decompose?  perhaps...FIXME)
                        #
                        @doInsideBlock runtime_invoke_bb, =>
                                calltmp = @createCall @ejs_runtime.invoke_closure, argv, "calltmp"
                                store = ir.createStore calltmp, call_result
                                ir.createBr invoke_merge_bb

                        # in the successful case we modify our argv with the responses and directly invoke the closure func
                        @doInsideBlock direct_invoke_bb, =>
                                direct_args = [ (@createLoad env_alloca, "env"), (@createLoad this_alloca, "this"), argv[2], argv[3] ]
                                calltmp = @createCall (@createLoad func_alloca, "func"), direct_args, "calltmp"
                                store = ir.createStore calltmp, call_result
                                ir.createBr invoke_merge_bb

                        ir.setInsertPoint invoke_merge_bb
                else
