Fixed bug in function init()