Fix 'cannot set property boolean of undefined'