Fix failure when mode attribute is accidentally omitted