Scala : Null dereference on some path