Back-port #284.