nested conditionals fix