bug fix, updated initialization function