added missing if checks