fixes GH-784 and GH-786