Fixed some functions scope