Fixed bug in the init method