fixed scope class and other fixes