diff --git a/src/main/scala/leon/utils/Library.scala b/src/main/scala/leon/utils/Library.scala
index aa9e60f4b95eae7b621238ba01ea94614d253a0b..c38f3b4cd23934588678562a86e80baeffd3fe74 100644
--- a/src/main/scala/leon/utils/Library.scala
+++ b/src/main/scala/leon/utils/Library.scala
@@ -8,17 +8,17 @@ import purescala.Types._
 import purescala.DefOps._
 
 case class Library(pgm: Program) {
-  lazy val List = lookup("leon.collection.List").collect{ case acd : AbstractClassDef => acd }.headOption
-  lazy val Cons = lookup("leon.collection.Cons").collect { case ccd : CaseClassDef => ccd }.headOption
-  lazy val Nil  = lookup("leon.collection.Nil").collect { case ccd : CaseClassDef => ccd }.headOption
+  lazy val List = lookup("leon.collection.List").collectFirst { case acd : AbstractClassDef => acd }
+  lazy val Cons = lookup("leon.collection.Cons").collectFirst { case ccd : CaseClassDef => ccd }
+  lazy val Nil  = lookup("leon.collection.Nil").collectFirst { case ccd : CaseClassDef => ccd }
 
-  lazy val Option = lookup("leon.lang.Option").collect { case acd : AbstractClassDef => acd }.headOption
-  lazy val Some = lookup("leon.lang.Some").collect { case ccd : CaseClassDef => ccd }.headOption
-  lazy val None = lookup("leon.lang.None").collect { case ccd : CaseClassDef => ccd }.headOption
+  lazy val Option = lookup("leon.lang.Option").collectFirst { case acd : AbstractClassDef => acd }
+  lazy val Some   = lookup("leon.lang.Some").collectFirst { case ccd : CaseClassDef => ccd }
+  lazy val None   = lookup("leon.lang.None").collectFirst { case ccd : CaseClassDef => ccd }
 
-  lazy val String = lookup("leon.lang.string.String").collect { case ccd : CaseClassDef => ccd }.headOption
+  lazy val String = lookup("leon.lang.string.String").collectFirst { case ccd : CaseClassDef => ccd }
 
-  lazy val setToList = lookup("leon.collection.setToList").collect { case fd : FunDef => fd }.headOption
+  lazy val setToList = lookup("leon.collection.setToList").collectFirst { case fd : FunDef => fd }
 
   def lookup(name: String): Seq[Definition] = {
     pgm.lookupAll(name)