Fixed bug in init method