added missing if statement