added missing if statements