Improved/fixed schema update code