Fixed bugs related to moving logic from __construct() to init().