fixed scope functions in controller