fixed scala 2.9 explosion and some bugs