Some work on fixing #630