added lock in maintenence proc
replication fix
logging