fix bug on nested conditionals