fix bug 3559, 'Opening preferences window causes out of bounds read'