diff --git a/src/main/scala/leon/codegen/CodeGeneration.scala b/src/main/scala/leon/codegen/CodeGeneration.scala
index 309c676ff872f6cd33f464982f709775e5214cbd..44140ba7a6f2f5996e9e0a81b2ed2c43aa0e1f84 100644
--- a/src/main/scala/leon/codegen/CodeGeneration.scala
+++ b/src/main/scala/leon/codegen/CodeGeneration.scala
@@ -702,6 +702,12 @@ trait CodeGeneration {
         ch << Ldc(id)
         ch << InvokeStatic(GenericValuesClass, "get", "(I)Ljava/lang/Object;")
       
+      case NoTree( tp@(Int32Type | BooleanType | UnitType | CharType)) =>
+        mkExpr(simplestValue(tp), ch)
+        
+      case NoTree(_) =>
+        ch << ACONST_NULL
+      
       case This(ct) =>
         ch << ALoad(0) // FIXME what if doInstrument etc