fixing scope of some function for tests