fix bugs with init method in constructor