Fixed init function bug