fixed side effects in initalization of classes