added if statement to fix CEP-531