Database upgrade script from 1.1 to 1.2
Final fixes