Fixing bug in convert database script