fix bugs of initializing beans