fixed order of conditions to avoid problems with private protection