Fixing maintenance script