Changes for Scala compatibility