Fixing minor bugs in sql upgrade for 1.2.3