Bug fixes to get this functional after three years of neglect