fix mode bugs