Fixed mode change handling

Apparent memory issues with using:

    if ( list.contains("foo")
instead, use
    if ("foo" in list)