fixed issue with nested conditionals