Adding condition to prevent db issues