fix #37, progress on #30