Added condition for maintenance flag