fixes some global/instance variable issues