fix urgent serious bug: issue #40