Bugs fixed in scripts related to database init and migrate