adding small fix to properly set index for nested if stmts