Fix bug in `onUpgrade()`