Small fixes. It fixes the nested logic.