resubmit of #983