This fixes #864,#827