remove wrong if

The outer if makes the inner condition not working